package com.jams.goodox.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by jams on 2016/8/15.
 * ***
 * Tel: ***
 */

public class Product implements Parcelable {

    /**
     * activityType : 2
     * originalPrice : 0.00
     * productCoverimg : /img/previous/sub/product_004e5750-ed91-11e4-901d-ac853da49bf6143022853534116.png
     * productId : 004e5750-ed91-11e4-901d-ac853da49bf6
     * productLimitBuy : 0
     * productName : 泰国榴莲
     * productPrice : 55.00
     * productSold : 0
     * productStock : 100000000
     * productUnit : 元/箱（斤，数量为个）
     * retailPrice : 205.00
     */

    private Double originalPrice;//产品原价
    private String productCoverimg;
    private String productId;
    private int productLimitBuy;
    private String productName;
    private Double productPrice;//产品价格
    private String productSold;
    private int productStock;
    private String productUnit;
    private String retailPrice;

    private boolean isSelected; // 是否是左边选中状态
    private String className; // 类型名称
    private int count; // 该用户已经选择了该商品的个数
    private int class_count; // 该用户已经选择了该类商品的个数
    private int class_index; //类别的index
    private String classId;//类别ID

    private String discountProductId;

    private int activityType;//0 秒杀1团 2正常
    private int isStarted;//1 活动进行中

    private String remainTime;



    public Product() {
        count = 0;
        class_count = 0;
        isSelected = false;
    }

    public String getDiscountProductId() {
        return discountProductId;
    }

    public void setDiscountProductId(String discountProductId) {
        this.discountProductId = discountProductId;
    }

    public int getIsStarted() {
        return isStarted;
    }

    public boolean isStart() {
        return isStarted == 1;
    }

    public void setIsStarted(int isStarted) {
        this.isStarted = isStarted;
    }

    public int getActivityType() {
        return activityType;
    }

    public void setActivityType(int activityType) {
        this.activityType = activityType;
    }

    public Double getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(Double originalPrice) {
        this.originalPrice = originalPrice;
    }

    public String getProductCoverimg() {
        return productCoverimg;
    }

    public void setProductCoverimg(String productCoverimg) {
        this.productCoverimg = productCoverimg;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public int getProductLimitBuy() {
        return productLimitBuy;
    }

    public void setProductLimitBuy(int productLimitBuy) {
        this.productLimitBuy = productLimitBuy;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Double getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(Double productPrice) {
        this.productPrice = productPrice;
    }

    public String getProductSold() {
        return productSold;
    }

    public void setProductSold(String productSold) {
        this.productSold = productSold;
    }

    public int getProductStock() {
        return productStock;
    }

    public void setProductStock(int productStock) {
        this.productStock = productStock;
    }

    public String getProductUnit() {
        return productUnit;
    }

    public void setProductUnit(String productUnit) {
        this.productUnit = productUnit;
    }

    public String getRetailPrice() {
        return retailPrice;
    }

    public void setRetailPrice(String retailPrice) {
        this.retailPrice = retailPrice;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String typeName) {
        this.className = typeName;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public int getClassCount() {
        return class_count;
    }

    public void setClassCount(int class_count) {
        this.class_count = class_count;
    }

    public int getClassIndex() {
        return class_index;
    }

    public void setClassIndex(int class_index) {
        this.class_index = class_index;
    }
    public String getClassId() {
        return classId;
    }

    public void setClassId(String classId) {
        this.classId = classId;
    }

    public String getRemainTime() {
        return remainTime;
    }

    public void setRemainTime(String remainTime) {
        this.remainTime = remainTime;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(this.originalPrice);
        dest.writeString(this.productCoverimg);
        dest.writeString(this.productId);
        dest.writeInt(this.productLimitBuy);
        dest.writeString(this.productName);
        dest.writeValue(this.productPrice);
        dest.writeString(this.productSold);
        dest.writeInt(this.productStock);
        dest.writeString(this.productUnit);
        dest.writeString(this.retailPrice);
        dest.writeByte(this.isSelected ? (byte) 1 : (byte) 0);
        dest.writeString(this.className);
        dest.writeInt(this.count);
        dest.writeInt(this.class_count);
        dest.writeInt(this.class_index);
        dest.writeString(this.classId);
        dest.writeString(this.discountProductId);
        dest.writeInt(this.activityType);
        dest.writeInt(this.isStarted);
        dest.writeString(this.remainTime);
    }

    protected Product(Parcel in) {
        this.originalPrice = (Double) in.readValue(Double.class.getClassLoader());
        this.productCoverimg = in.readString();
        this.productId = in.readString();
        this.productLimitBuy = in.readInt();
        this.productName = in.readString();
        this.productPrice = (Double) in.readValue(Double.class.getClassLoader());
        this.productSold = in.readString();
        this.productStock = in.readInt();
        this.productUnit = in.readString();
        this.retailPrice = in.readString();
        this.isSelected = in.readByte() != 0;
        this.className = in.readString();
        this.count = in.readInt();
        this.class_count = in.readInt();
        this.class_index = in.readInt();
        this.classId = in.readString();
        this.discountProductId = in.readString();
        this.activityType = in.readInt();
        this.isStarted = in.readInt();
        this.remainTime = in.readString();
    }

    public static final Creator<Product> CREATOR = new Creator<Product>() {
        @Override
        public Product createFromParcel(Parcel source) {
            return new Product(source);
        }

        @Override
        public Product[] newArray(int size) {
            return new Product[size];
        }
    };
}
